uniform sampler2D	textureSampler;
uniform sampler2D	normalSampler;

uniform vec2 imageSize;
varying vec2 texCoords;

void main()
{

	// lookup texture
	vec3 textureSample	= texture2D(textureSampler, texCoords).rgb;
	
	// lookup normal
	vec3 normal  = texture2D(normalSampler, gl_FragCoord.xy / imageSize).rgb;
	normal = normalize(2.0 * normal - 1.0);
		
	// compute diffuse
	float k = max( dot( normal, normalize(vec3(0.0,0.2,1.0))), 0.0 );
	vec3 color			= k * textureSample;

	// compute final color
	gl_FragData[0] = vec4( color, 1.0 );
	gl_FragData[1] = vec4( textureSample, 1.0 );


}